package cn.edu.ctbu.thymeleafwork.service;

import cn.edu.ctbu.thymeleafwork.domain.Student;
import cn.edu.ctbu.thymeleafwork.repository.StudentRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public interface StudentService {


    List<Student> findAll();

    /**
     * 只支持分页的查询
     * @param pageable
     * @return
     */

    /**
     * 分页，带过滤的查询
     * @param pageable
     * @return
     */
    public Page<Student> findAll(Example<Student> student,Pageable pageable);

    Page<Student> findAll(Pageable pageable);

    Student insert(Student student);

    Student update(Student student);

    void delete(Student student);

    void delete(Integer id);

    Page<Student> findByName(String name, Pageable pageable);

    Student getById(Integer id);

    List<Student> findByNameLike(String name);

    /**
     * 验证用户名和密码
     * @param username
     * @param password
     */
    Student validataUsernameAndPassword(String username,String password) throws Exception;

    List<Student> findByNameAndPassword(String name,String password);
}